//
//  EditLightCombinationsViewController.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/25.
//

#import "EditLightCombinationsViewController.h"
#import "EditLightLombinationsCell.h"

@interface EditLightCombinationsViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView *_Tabview;
    EditLightLombinationsCell *Cell;
}
@end

@implementation EditLightCombinationsViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];
    //隐藏头部view
    self.navigationController.navigationBar.hidden = YES;
    NavigationHeadView *navgationheadv = [[NavigationHeadView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, SafeAreaTopHight)];
    navgationheadv.titlelabel.text = @"编辑灯光组合";
    navgationheadv.titlelabel.textColor = [UIColor blackColor];
    navgationheadv.backbtn.hidden = NO;
    [navgationheadv.backbtn addTarget:self action:@selector(returnback) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:navgationheadv];
    UIView *backV = [[UIView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHight, APPwidth, 100)];
    backV.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:backV];
    
    UIView *titleLine = [[UIView alloc]initWithFrame:CGRectMake(15, 15, 3, 15)];
    titleLine.backgroundColor = rgba(22, 120, 255, 1);
    titleLine.layer.cornerRadius = 2;
    [backV addSubview:titleLine];
    UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(titleLine.frame.size.width+titleLine.frame.origin.x+5,15, 70, 15)];
    titleLab.text = @"标题";
    titleLab.textColor = [UIColor blackColor];
    titleLab.textAlignment = 0;
    titleLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:titleLab];
    
    UILabel *typeLab = [[UILabel alloc]initWithFrame:CGRectMake(15,  titleLab.frame.size.height + titleLab.frame.origin.y+15, APPwidth-30, 20)];
    typeLab.text = @"*新灯光2";
    typeLab.textColor = rgba(51, 51, 51, 1);
    typeLab.textAlignment = 0;
    typeLab.font = [UIFont systemFontOfSize:16];
    [backV addSubview:typeLab];
    
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, backV.height-10, APPwidth, 10)];
    line.backgroundColor = rgba(245, 245, 250, 1);
    [backV addSubview:line];
    
    UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHight, APPwidth, 100)];
    bottomView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bottomView];

    //底部
    NSArray *deletorkeeparr  = @[@"删除组合",@"保存"];

    for (int i = 0; i < deletorkeeparr.count; i++) {
        
    UIButton *bmBtn = [[UIButton alloc]initWithFrame:CGRectMake(10+(APPwidth-30)/2*i, 20, (APPwidth-30)/2, 50)];
    [bmBtn setTitle:deletorkeeparr[i] forState:0];
    bmBtn.contentHorizontalAlignment = 0;
    [bmBtn setTitleColor:[UIColor whiteColor] forState:0];
    bmBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [bmBtn setBackgroundColor:rgba(255, 107, 107, 1)];
    bmBtn.layer.cornerRadius = 50/2;
    [bottomView addSubview:bmBtn];
    }
    
    _Tabview  = [[UITableView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHight, APPwidth, APPheight-SafeAreaTopHight-80)];
    _Tabview.delegate = self;
    _Tabview.dataSource = self;
    _Tabview.separatorStyle = UITableViewCellSeparatorStyleNone;
    _Tabview.tableHeaderView = backV;
    _Tabview.tableFooterView = bottomView;
    [self.view addSubview:_Tabview];
    
    //
    NSArray *meselfArr  = @[@"自定义指令",@"试听"];

    for (int i = 0; i < meselfArr.count; i++) {
        
    UIButton *zdyBtn = [[UIButton alloc]initWithFrame:CGRectMake(APPwidth/2*i, APPheight - SafeAreaBottomHeight-50, APPwidth/2, 50)];
    [zdyBtn setTitle:meselfArr[i] forState:0];
        zdyBtn.contentHorizontalAlignment = 0;
    [zdyBtn setTitleColor:[UIColor blackColor] forState:0];
        zdyBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [zdyBtn setBackgroundColor:rgba(255, 107, 107, 1)];
        zdyBtn.layer.shadowColor = [UIColor grayColor].CGColor;
        zdyBtn.layer.shadowOpacity = 0.5;
        zdyBtn.layer.shadowOffset = CGSizeMake(0, 1);
        zdyBtn.layer.shadowRadius = 2;
        
    [self.view addSubview:zdyBtn];
        
        if (i == 0 ) {
            [zdyBtn setBackgroundColor:[UIColor whiteColor]];

        }else{
            [zdyBtn setBackgroundColor:rgba(38, 194, 126, 1)];
            [zdyBtn setTitleColor:[UIColor whiteColor] forState:0];

        }
    }
    
    
    
    
    
}
#pragma mark - UITableView DataSource

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 140;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString * str = @"cell";
    
    Cell  = [tableView dequeueReusableCellWithIdentifier:str];
    if (Cell == nil) {
        
        Cell = [[EditLightLombinationsCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:str];
    }
    
//    Cell.nameLab.text = @"学员:小芒果";
    
    Cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return Cell;
}





-(void)returnback{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark -视图即将出现
-(void)viewWillAppear:(BOOL)animated{
        
    ((TabbarController *)self.tabBarController).tabBarView.hidden = YES;
    
}


@end
